home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / tcl / demos / mkLabel.tcl < prev    next >
Encoding:
Text File  |  1992-08-13  |  1.3 KB  |  34 lines

  1. # mkLabel w
  2. #
  3. # Create a top-level window that displays a bunch of labels.
  4. #
  5. # Arguments:
  6. #    w -    Name to use for new top-level window.
  7.  
  8. proc mkLabel {{w .l1}} {
  9.     global tk_library
  10.     catch {destroy $w}
  11.     toplevel $w
  12.     dpos $w
  13.     wm title $w "Label Demonstration"
  14.     wm iconname $w "Labels"
  15.     message $w.msg -font -Adobe-times-medium-r-normal--*-180* -aspect 300 \
  16.         -text "Five labels are displayed below: three textual ones on the left, and a bitmap label and a text label on the right.  Labels are pretty boring because you can't do anything with them.  Click the \"OK\" button when you've seen enough."
  17.     frame $w.frame -borderwidth 10
  18.     pack append $w.frame \
  19.     [frame $w.frame.right -borderwidth 10] {right} \
  20.     [label $w.frame.l1 -text "First label"] {top frame w pady 4 expand} \
  21.     [label $w.frame.l2 -text "Second label, raised just for fun" \
  22.         -relief raised] {top frame w pady 4 expand} \
  23.     [label $w.frame.l3 -text "Third label, sunken" -relief sunken ] \
  24.         {top frame w pady 4 expand}
  25.     pack append $w.frame.right \
  26.     [label $w.frame.right.bitmap -bitmap @$tk_library/demos/bitmaps/face \
  27.         -borderwidth 2 -relief sunken] top \
  28.     [label $w.frame.right.caption -text "Tcl/Tk Proprietor"] bottom
  29.     button $w.ok -text OK -command "destroy $w"
  30.  
  31.     pack append $w $w.msg {top frame c} $w.frame {top expand fill} \
  32.         $w.ok {bottom fill}
  33. }
  34.